#pragma once
#include "Support.h"
#include "Entity\Player.h"
#include "SelectScene.h"
USING_NS_CC;

class SelectButton : public Node {
public:
	static SelectButton* createButton(const char *buttonName, Vec2 pos, Node *scene);
	void setPreSkills(__Array *preSkills);
	void onStart();
	void onStop();
	void unLock();
	void changeSelected();
	CC_SYNTHESIZE_READONLY(bool, m_isSelected, Selected);
	void setSelected(bool selected);
	~SelectButton();
protected:
	bool initButton(const char *buttonName, Vec2 pos, Node *scene);
private:
	Node *m_parentNode;
	__Array *m_preSkills;
	bool m_upgrade_enable;
	__String *m_buttonName;
	bool m_isLocked;
	EventListenerTouchOneByOne *m_listener;
	Sprite *m_showSprite;
	Sprite *m_unselectedicon;
	SpriteFrame *m_texture_up;
	SpriteFrame *m_texture_down;
	SpriteFrame *m_texture_locked;
	bool isTouchedInside(Touch *pTouch);

	bool onTouchBegan(Touch *pTouch, Event *event);
	void onTouchMoved(Touch *pTouch, Event *event);
	void onTouchEnded(Touch *pTouch, Event *event);
};